package com.anhuanjia.tools.eao.util;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.util.StringUtils;

import com.anhuanjia.tools.eao.bean.EaoAppraise;
import com.anhuanjia.tools.eao.bean.EaoAuditReply;
import com.anhuanjia.tools.eao.bean.EaoBuildingContent;
import com.anhuanjia.tools.eao.bean.EaoProductionEquipment;
import com.anhuanjia.tools.eao.bean.EaoProjectDoc;
import com.anhuanjia.tools.eao.bean.EaoProjectInfo;
import com.anhuanjia.tools.eao.bean.EaoPublicProject;
import com.anhuanjia.tools.eao.bean.EaoPublicityQuestions;
import com.anhuanjia.tools.eao.bean.EaoSensitivePoints;
import com.anhuanjia.tools.eao.bean.EaoSurroundCompany;
import com.efastsoft.framework.Member;
import com.efastsoft.framework.data.DataRow;
import com.efastsoft.framework.data.DataTable;
import com.efastsoft.framework.data.Q;
import com.efastsoft.framework.utility.StringUtil;

public class PrintWordUtil {
	public Map<String, String> getMap(String pid) {

		String id = null;// 主键

		String project_number = null;// 项目编号

		String project_name = null;// 项目名称

		String build_unit = null;// 建设单位

		String legal_person = null;// 法人

		String linkman = null;// 联系人

		String mail_area_code = null;// 通讯地址地区代码

		String mail_address = null;// 通讯地址具体位置

		String tel_number = null;// 联系电话

		String mail_zip_code = null;// 邮政编码

		String build_area_code = null;// 建设地点地区代码

		String build_address = null;// 建设地点具体位置

		String bulid_property = null;// 建设性质

		String floor_space = null;// 占地面积

		String green_space = null;// 绿化面积

		String total_investment = null;// 总投资

		String contract_amount = null;// 环评合同额

		String product_name = null;// 产品名称

		String production_scale = null;// 生产规模

		String project_approval_unit = null;// 立项审批部门

		String project_code = null;// 项目代码

		String economy_industry_type = null;// 国民经济行业类型

		String eia_assess_category = null;// 环评分类管理名录

		String report_type = null;// 报告类型

		String report_special_item = null;// 报告专项

		String industrial_policy = null;// 产业政策

		String industry_access = null;// 行业准入

		String grade_approval = null;// 分级审批

		String approval_unit = null;// 审批部门

		String land_conformity = null;// 土地相符性

		String planning_conformity = null;// 规划相符性

		String project_coordinates = null;// 项目坐标

		String labor_quota = null;// 劳动定员_总人数

		String labor_stay = null;// 劳动定员_住宿

		String labor_canteen = null;// 劳动定员_食堂

		String production_process = null;// 生产工艺

		String site_status = null;// 场地现状

		String org_pollution_situation = null;// 原有污染情况

		String masses_opinions = null;// 群众对项目的意见

		String scene_problems = null;// 现场存在的环境问题

		String survey_personnel = null;// 踏勘人员

		String survey_date = null;// 踏勘日期

		String quote_data = null;// 引用数据

		String quote_data_source = null;// 数据来源

		String quote_item = null;// 引用项

		String actual_monitor = null;// 实际监测

		String test_item = null;// 检测项

		String create_person = null; // 项目创建人 Mh_Resource表member

		String perject_leader = null;// 项目负责人 Mh_Resource表member

		String ReportChapter = null;// 项目负责人负责章节

		String perject_type = null;// 状态(ProcedureUtils类字段)

		String perject_time = null;// 创建时间

		String ent_time = null; // 结束时间

		String IsHide = null;// 是否在后台隐藏（0否 1是）

		String Audit_date = null;// 送审日期

		String Batch_date = null;// 报批日期

		String Document_storage_location = null;// 纸质资料存档位置

		String Archivists_opinion = null; // 档案员意见

		String Appraise_date = null; // 档案员意见

		String Appraise_address = null;// 评估会议地点

		String Appraise_person = null;// 评估专家

		// 项目资料
		String project_contract = null; // 项目合同

		String project_trust_instrument = null;// 项目委托书

		String org_eia_report = null;// 原环评报告

		String org_eia_reply = null;// 原环评批复

		String org_project_acceptance_doc = null;// 原项目验收文件

		String org_project_monitoring_doc = null;// 原项目实际监测文件

		String factory_flat_map = null;// 厂区现有平面图

		String existing_waste_water = null;// 厂区现有环保设施情况

		String land_doc = null;// 土地文件

		String planning_doc = null;// 规划文件

		String create_project_doc = null;// 立项文件

		String project_proposal = null; // 可研/项目建议书

		String project_flat_map = null;// 项目平面图

		String project_other_doc = null;// 其他资料(资料收集)

		String other_collect_info = null;// 其他资料(现场踏勘)

		String live_image = null;// 现场影像

		String project_env_overview = null;// 项目周围环境概况图

		String quote_report = null;// 引用报告

		String monitor_point_map = null;// 监测点位示意图

		String monitor_plan = null;// 监测方案

		String actual_test_report = null;// 检测报告

		String actual_monitor_point_map = null;// 监测布点图

		String AStandard_letter = null; // 执行标准函

		String Coordinate_map = null;// 地理位置图

		String River_system_map = null;// 项目水系图

		String Report_original = null;// 报告原件

		String Report_auditor = null;// 送审版报告

		String Report_batch = null;// 报批版报告

		String Surver = null;// 现场踏勘表

		String Basic_information = null; // 基础信息表

		String Audit_data = null;// 审核资料表

		String Project_Status_map = null;// 项目周围现状图

		String Project_batch_data = null;// 项目批复或审批文件

		String Assess_sign = null;// 评估意见、签字表

		String Standard_execution = null;// 环评执行标准文件
		// --公参资料
		String Build_public_promise = null;// 建设单位公众参与承诺函

		String Public_printscreen_url = null;// 两次公示（建设单位盖章）网上公示截图及网址

		String Public_cens = null;// 公众参与调查表

		String Public_opinion = null;// 公参提交意见的原始文件

		String Public_special_reports = null;// 公参专题报告（建设单位盖章)

		String Hearing_data = null;// 听证会相关资料

		String Forum_data = null;// 座谈会相关资料

		String Build_public_text = null;// 或建设单位公参单行本

		String Build_other_data = null;// 建设单位提供的其他资料

		String Report_change = null; // 修改后报告

		String Appraise_data = null; // 专家评估文件

		String PublicImg = null;// 公参截图

		String Report_public = null;// 公参报告

		// 公共工程
		String water_supply_method = null;// 供水方式

		String power_supply_method = null;// 供电方式

		String sewage_water = null;// 排水去向_纳污水体

		String sewage_water_ability = null;// 排水去向_纳污水体功能

		String sewage_path = null;// 排水去向_排污路径

		String sewage_plant = null;// 排水去向_污水处理厂

		String provide_heat = null;// 供热取暖

		String fuel_supply = null;// 燃料及供应方式

		EaoProjectInfo projectInfo = new EaoProjectInfo();

		EaoProjectDoc projectDoc = new EaoProjectDoc();

		EaoPublicProject publicProject = new EaoPublicProject();

		// Audit audit = new Audit();
		// dt 获取项目编号下所有info信息
		DataTable dt = new Q("select * from eao_project_info where Id =?", pid).fetch();
		for (DataRow dr : dt) {
			projectInfo.setValue(dr);
			DataTable dt2 = new Q("select FullName from Mh_Resource where Member = ? ", projectInfo.getPerjectLeader())
					.fetch();
			for (DataRow dr2 : dt2) {
				perject_leader = dr2.getString("FullName");
			}

			DataTable dt3 = new Q("select FullName from Mh_Resource where Member = ? ", projectInfo.getCreatePerson())
					.fetch();
			for (DataRow dr3 : dt3) {
				create_person = dr3.getString("FullName");
			}
		}
		// dt2 获取项目编号下所有项目资料数据
		DataTable dt2 = new Q("select * from eao_project_doc where ProjectId =?", pid).fetch();
		for (DataRow dr2 : dt2) {
			projectDoc.setValue(dr2);
		}
		// dt3 获取项目编号下所有公共设施数据
		DataTable dt3 = new Q("select * from eao_public_project where ProjectId =?", pid).fetch();
		for (DataRow dr3 : dt3) {
			publicProject.setValue(dr3);
		}
		// dt4获取项目项目编号所对应成员名单
		DataTable dt4 = new Q(
				"select GROUP_CONCAT(StaffsName) as StaffNames from(select  ProjectId,FullName as staffsName from eao_project_staff as staff LEFT JOIN Mh_Resource on staff.StaffName=Mh_Resource.Member)as cy where ProjectId = ? GROUP BY ProjectId",
				pid).fetch();
		String staffs = ""; // dt4.getString(0, 0); // 项目成员
		for (DataRow dr4 : dt4) {
			staffs = dr4.getString(0);
		}
		// 存档-文件数量
		DataTable dt5 = new Q(
				"select ProjectDataName,DataStock from eao_data_bill where ProjectId =? order by ProjectDataName", pid)
						.fetch();
		Map<String, String> xmap = new HashMap<String, String>();
		for (DataRow dr5 : dt5) {
			String key = dr5.getString("Project_data_name");
			String value = dr5.getString("Data_stock");
			xmap.put(key, value);
		}
		// dt6获取公示网址链接
		DataTable dt6 = new Q(
				"select PublicityTime,PublicityUrlName,PublicityUrl from eao_publicity_url where ProjectId = ?", pid)
						.fetch();
		String Publicity_time = null;
		String Publicity_url_name = null;
		String Publicity_url = null;
		for (DataRow dr6 : dt6) {
			Publicity_time = dr6.getString("PublicityTime");
			Publicity_url_name = dr6.getString("PublicityUrlName");
			Publicity_url = dr6.getString("PublicityUrl");
		}

		String b0 = xmap.get("0");// 项目合同数量
		String b1 = xmap.get("1");// 项目委托书··
		String b2 = xmap.get("2");// 现场踏勘表··
		String b3 = xmap.get("3");// 项目周围现状图··
		String b4 = xmap.get("4");// 三级审核··
		String b5 = xmap.get("5");// 项目批复或审批··
		String b6 = xmap.get("6");// 评估意见、签字表··
		String b7 = xmap.get("7");// 环评执行标准文件··
		String b8 = xmap.get("8");// 环境监测报告原件··
		String b9 = xmap.get("9");// 建设单位公参承诺··
		String b10 = xmap.get("10");// 两次公示、截图、网址··
		String b11 = xmap.get("11");// 公众参与调查表··
		String b12 = xmap.get("12");// 公参提交意见的原始文件··
		String b13 = xmap.get("13");// 公众参与专题报告··
		String b14 = xmap.get("14");// 听证会相关··
		String b15 = xmap.get("15");// 座谈会相关··
		String b16 = xmap.get("16");// 或建设单位公参单行本··
		String b17 = xmap.get("17");// 送审版报告··
		String b18 = xmap.get("18");// 报批版报告··
		String b19 = xmap.get("19");// 建设单位提供的其他资料··
		String b20 = xmap.get("20");// 纸质资料存档位置··
		// 公用工程
		water_supply_method = publicProject.getWaterSupplyMethod();
		power_supply_method = publicProject.getPowerSupplyMethod();
		sewage_water = publicProject.getSewageWater();
		sewage_water_ability = publicProject.getSewageWaterAbility();
		sewage_path = publicProject.getSewagePath();
		sewage_plant = publicProject.getSewagePlant();
		provide_heat = publicProject.getProvideHeat();
		fuel_supply = publicProject.getFuelSupply();
		// 资料
		project_contract = projectDoc.getProjectContract();
		project_trust_instrument = projectDoc.getProjectTrustInstrument();
		org_eia_report = projectDoc.getOrgEiaReport();
		org_eia_reply = projectDoc.getOrgEiaReply();
		org_project_acceptance_doc = projectDoc.getOrgProjectAcceptanceDoc();
		org_project_monitoring_doc = projectDoc.getOrgProjectMonitoringDoc();
		factory_flat_map = projectDoc.getFactoryFlatMap();
		existing_waste_water = projectDoc.getExistingWasteWater();
		land_doc = projectDoc.getLandDoc();
		planning_doc = projectDoc.getPlanningDoc();
		create_project_doc = projectDoc.getCreateProjectDoc();
		project_proposal = projectDoc.getProjectProposal();
		project_flat_map = projectDoc.getProjectFlatMap();
		project_other_doc = projectDoc.getProjectOtherDoc();
		other_collect_info = projectDoc.getOtherCollectInfo();
		live_image = projectDoc.getLiveImage();
		project_env_overview = projectDoc.getProjectEnvOverview();
		quote_report = projectDoc.getQuoteReport();
		monitor_point_map = projectDoc.getMonitorPointMap();
		monitor_plan = projectDoc.getMonitorPlan();
		actual_test_report = projectDoc.getActualTestReport();
		actual_monitor_point_map = projectDoc.getActualMonitorPointMap();
		AStandard_letter = projectDoc.getAStandardLetter();
		Coordinate_map = projectDoc.getCoordinateMap();
		River_system_map = projectDoc.getRiverSystemMap();
		// --
		Report_original = projectDoc.getReportOriginal();
		Report_auditor = projectDoc.getReportAuditor();// 送审版报告
		Report_batch = projectDoc.getReportBatch();// 报批版报告
		Surver = projectDoc.getSurver();// 现场踏勘表
		Basic_information = projectDoc.getBasicInformation();
		Audit_data = projectDoc.getAuditData();// 审核资料表
		Project_Status_map = projectDoc.getProjectStatusMap();// 项目周围现状图
		Project_batch_data = projectDoc.getProjectBatchData();// 项目批复或审批文件
		Assess_sign = projectDoc.getAssessSign();// 评估意见、签字表
		Standard_execution = projectDoc.getStandardExecution();// 环评执行标准文件
		Build_public_promise = projectDoc.getBuildPublicPromise();// 建设单位公众参与承诺函
		Public_printscreen_url = projectDoc.getPublicPrintscreenUrl();// 两次公示（建设单位盖章）网上公示截图及网址
		Public_cens = projectDoc.getPublicCens();// 公众参与调查表
		Public_opinion = projectDoc.getPublicOpinion();// 公参提交意见的原始文件
		Public_special_reports = projectDoc.getPublicSpecialReports();// 公参专题报告（建设单位盖章)
		Hearing_data = projectDoc.getHearingData();// 听证会相关资料
		Forum_data = projectDoc.getForumData();// 座谈会相关资料
		Build_public_text = projectDoc.getBuildPublicText();// 或建设单位公参单行本
		Build_other_data = projectDoc.getBuildOtherData();// 建设单位提供的其他资料
		Report_change = projectDoc.getReportChange(); // 修改后报告（评估后）
		Appraise_data = projectDoc.getAppraiseData(); // 专家评估资料
		PublicImg = projectDoc.getPublicImg();// 公参截图
		Report_public = projectDoc.getReportPublic();// 公参报告

		// 项目
		id = projectInfo.getId();
		project_name = projectInfo.getProjectName();
		project_number = projectInfo.getProjectNumber();
		build_unit = projectInfo.getBuildUnit();
		legal_person = projectInfo.getLegalPerson();
		linkman = projectInfo.getLinkman();
		mail_area_code = projectInfo.getMailAreaCode();
		mail_address = projectInfo.getMailAddress();
		tel_number = projectInfo.getTelNumber();
		mail_zip_code = projectInfo.getMailZipCode();
		build_area_code = projectInfo.getBuildAreaCode();
		build_address = projectInfo.getBuildAddress();
		bulid_property = projectInfo.getBulidProperty();
		floor_space = projectInfo.getFloorSpace();
		green_space = projectInfo.getGreenSpace();
		total_investment = projectInfo.getTotalInvestment();
		contract_amount = projectInfo.getContractAmount();
		product_name = projectInfo.getProductName();
		production_scale = projectInfo.getProductionScale();
		project_approval_unit = projectInfo.getProjectApprovalUnit();
		project_code = projectInfo.getProjectCode();
		economy_industry_type = projectInfo.getEconomyIndustryType();
		economy_industry_type = GBTUtil.getname(economy_industry_type);
		eia_assess_category = projectInfo.getEiaAssessCategory();
		eia_assess_category = GBTUtil.getManagement(eia_assess_category);
		report_type = projectInfo.getReportType();
		report_special_item = projectInfo.getReportSpecialItem();
		industrial_policy = projectInfo.getIndustrialPolicy();
		industry_access = projectInfo.getIndustryAccess();
		grade_approval = projectInfo.getGradeApproval();
		approval_unit = projectInfo.getApprovalUnit();
		land_conformity = projectInfo.getLandConformity();
		planning_conformity = projectInfo.getPlanningConformity();
		project_coordinates = projectInfo.getProjectCoordinates();
		labor_quota = projectInfo.getLaborQuota();
		labor_stay = projectInfo.getLaborStay();
		labor_canteen = projectInfo.getLaborCanteen();
		production_process = projectInfo.getProductionProcess();
		site_status = projectInfo.getSiteStatus();
		org_pollution_situation = projectInfo.getOrgPollutionSituation();
		masses_opinions = projectInfo.getMassesOpinions();
		scene_problems = projectInfo.getSceneProblems();
		survey_personnel = projectInfo.getSurveyPersonnel();
		survey_date = projectInfo.getSurveyDate();
		quote_data = projectInfo.getQuoteData();
		quote_data_source = projectInfo.getQuoteDataSource();
		if (StringUtil.isNotEmpty(projectInfo.getQuoteItem())) {
			String[] quoteItem = projectInfo.getQuoteItem().split("\"");
			for (String string : quoteItem) {
				if ("1".equals(string)) {
					if (StringUtils.isEmpty(quote_item)) {
						quote_item = "地表水";
					} else {
						quote_item = quote_item + "," + "地表水";
					}
				} else if ("2".equals(string)) {
					if (StringUtils.isEmpty(quote_item)) {
						quote_item = "大气";
					} else {
						quote_item = quote_item + "," + "大气";
					}
				} else if ("3".equals(string)) {
					if (StringUtils.isEmpty(quote_item)) {
						quote_item = "噪声";
					} else {
						quote_item = quote_item + "," + "噪声";
					}
				} else if ("4".equals(string)) {
					if (StringUtils.isEmpty(quote_item)) {
						quote_item = "地下水";
					} else {
						quote_item = quote_item + "," + "地下水";
					}
				}
			}
		}
		actual_monitor = projectInfo.getActualMonitor();
		if (StringUtil.isNotEmpty(projectInfo.getTestItem())) {
			String[] testItem = projectInfo.getTestItem().split("\"");
			for (String string : testItem) {
				if ("1".equals(string)) {
					if (StringUtils.isEmpty(test_item)) {
						test_item = "地表水";
					} else {
						test_item = test_item + "," + "地表水";
					}
				} else if ("2".equals(string)) {
					if (StringUtils.isEmpty(test_item)) {
						test_item = "大气";
					} else {
						test_item = test_item + "," + "大气";
					}
				} else if ("3".equals(string)) {
					if (StringUtils.isEmpty(test_item)) {
						test_item = "噪声";
					} else {
						test_item = test_item + "," + "噪声";
					}
				} else if ("4".equals(string)) {
					if (StringUtils.isEmpty(test_item)) {
						test_item = "地下水";
					} else {
						test_item = test_item + "," + "地下水";
					}
				}
			}
		}
		perject_type = projectInfo.getPerjectType().toString();
		perject_time = projectInfo.getPerjectTime().toString();
		Date enttime = projectInfo.getEntTime();
		SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
		if (enttime != null) {
			ent_time = sd.format(enttime);
		}
		IsHide = projectInfo.getIsHide();
		Audit_date = projectInfo.getAuditDate();
		Batch_date = projectInfo.getBatchDate();
		Document_storage_location = projectInfo.getDocumentStorageLocation();
		Archivists_opinion = projectInfo.getArchivistsOpinion();
		ReportChapter = projectInfo.getReportChapter();
		Appraise_date = projectInfo.getAppraiseDate();
		Appraise_address = projectInfo.getAppraiseAddress();
		Appraise_person = projectInfo.getAppraisePerson();

		Date nowDay = new Date();
		Map<String, String> testMap = new HashMap<String, String>();
		testMap.put("nowday", "日期：" + sd.format(nowDay)); // 当前时间
		testMap.put("staffs", staffs);

		testMap.put("id", id); // 项目信息主键
		testMap.put("pid", project_number); // 项目id
		testMap.put("pname", project_name); // 项目名称
		testMap.put("build", build_unit); // 建筑单位
		testMap.put("lperson", legal_person); // 法人
		testMap.put("linkman", linkman); // 联系人
		testMap.put("mailarea", mail_area_code); // 通讯地址地区代码
		testMap.put("address", mail_address); // 通讯地址具体位置
		testMap.put("telnumber", tel_number); // 联系电话
		testMap.put("mailzip", mail_zip_code); // 邮政编码
		testMap.put("buildareacode", build_area_code); // 建设地点地区代码
		testMap.put("buildaddress", build_address); // 建设地点具体位置
		testMap.put("buildproperty", bulid_property); // 建设性质
		testMap.put("floorspace", floor_space); // 占地面积
		testMap.put("greenspace", green_space);// 绿化面积
		testMap.put("total", total_investment);// 总投资
		testMap.put("contract", contract_amount);// 环评合同额
		testMap.put("productname", product_name);// 产品名称
		testMap.put("production", production_scale); // 生产规模
		testMap.put("approval", project_approval_unit);// 立项审批部门
		testMap.put("pcode", project_code);// 项目代码
		testMap.put("etype", economy_industry_type);// 国民经济行业类型
		testMap.put("category", eia_assess_category);// 环评分类管理名录
		testMap.put("reporttype", report_type);// 报告类型
		testMap.put("specialitem", report_special_item);// 报告专项
		testMap.put("policy", industrial_policy);// 产业政策
		testMap.put("industryaccess", industry_access);// 行业准入
		testMap.put("gradeapproval", grade_approval);// 分级审批
		testMap.put("approvalunit", approval_unit);// 审批部门
		testMap.put("landconformity", land_conformity);// 土地相符性
		testMap.put("planningconformity", planning_conformity);// 规划相符性
		testMap.put("projectcoordinates", project_coordinates);// 项目坐标
		testMap.put("laborquota", labor_quota);// 劳动定员_总人数
		testMap.put("laborstay", labor_stay);// 劳动定员_住宿
		testMap.put("laborcanteen", labor_canteen);// 劳动定员_食堂
		testMap.put("productionprocess", production_process);// 生产工艺
		testMap.put("sitestatus", site_status);// 场地现状
		testMap.put("orgpollutionsituation", org_pollution_situation);// 原有污染情况
		testMap.put("massesopinions", masses_opinions);// 群众对项目的意见
		testMap.put("sceneproblems", scene_problems);// 现场存在的环境问题
		testMap.put("surveypersonnel", survey_personnel);// 踏勘人员
		testMap.put("surveydate", survey_date);// 踏勘日期
		testMap.put("quotedata", quote_data);// 引用数据
		testMap.put("quotedatasource", quote_data_source);// 数据来源
		testMap.put("quoteitem", quote_item);// 引用项
		testMap.put("actualmonitor", actual_monitor);// 实际监测
		testMap.put("testitem", test_item);// 检测项
		testMap.put("createperson", create_person); // 项目创建人
		testMap.put("perjectleader", perject_leader); // 项目负责人
		testMap.put("ReportChapter", ReportChapter); // 项目负责人负责章节
		testMap.put("perjecttype", perject_type); // 状态
		testMap.put("perjecttime", perject_time); // 创建时间
		testMap.put("enttime", ent_time);
		testMap.put("IsHide", IsHide);
		testMap.put("Auditdate", Audit_date);
		testMap.put("Batchdate", Batch_date);
		testMap.put("Documentstoragelocation", Document_storage_location);
		testMap.put("Archivistsopinion", Archivists_opinion);
		testMap.put("Appraisedate", Appraise_date);
		testMap.put("Appraiseaddress", Appraise_address);
		testMap.put("Appraiseperson", Appraise_person);

		// 资料
		testMap.put("项目合同", project_contract);
		testMap.put("项目委托书", project_trust_instrument);
		testMap.put("原环评报告", org_eia_report);
		testMap.put("原环评批复", org_eia_reply);
		testMap.put("原项目验收文件", org_project_acceptance_doc);
		testMap.put("原项目实际监测文件", org_project_monitoring_doc);
		testMap.put("厂区现有平面图", factory_flat_map);
		testMap.put("厂区现有环保设施情况", existing_waste_water);
		testMap.put("土地文件", land_doc);
		testMap.put("规划文件", planning_doc);
		testMap.put("立项文件", create_project_doc);
		testMap.put("可研/项目建议书", project_proposal);
		testMap.put("项目平面图", project_flat_map);
		testMap.put("其他收集资料", project_other_doc);
		testMap.put("其他踏勘资料", other_collect_info);
		testMap.put("现场影像", live_image);
		testMap.put("项目周围环境概况图", project_env_overview);
		testMap.put("引用报告", quote_report);
		testMap.put("监测点位示意图", monitor_point_map);
		testMap.put("监测方案", monitor_plan);
		testMap.put("检测报告", actual_test_report);
		testMap.put("监测布点图", actual_monitor_point_map);
		testMap.put("执行标准函", AStandard_letter);
		testMap.put("地理位置图", Coordinate_map);
		testMap.put("项目水系图", River_system_map);
		testMap.put("Report_original", Report_original);
		testMap.put("Report_auditor", Report_auditor);
		testMap.put("Report_batch", Report_batch);
		testMap.put("Surver", Surver);
		testMap.put("Basic_information", Basic_information);
		testMap.put("Audit_data", Audit_data);
		testMap.put("Project_Status_map", Project_Status_map);
		testMap.put("Project_batch_data", Project_batch_data);
		testMap.put("Assess_sign", Assess_sign);
		testMap.put("Standard_execution", Standard_execution);
		testMap.put("Build_public_promise", Build_public_promise);
		testMap.put("Public_printscreen_url", Public_printscreen_url);
		testMap.put("Public_cens", Public_cens);
		testMap.put("Public_opinion", Public_opinion);
		testMap.put("Public_special_reports", Public_special_reports);
		testMap.put("Hearing_data", Hearing_data);
		testMap.put("Forum_data", Forum_data);
		testMap.put("Build_public_text", Build_public_text);
		testMap.put("Build_other_data", Build_other_data);
		testMap.put("Appraise_data", Appraise_data);
		testMap.put("Report_change", Report_change);
		testMap.put("PublicImg", PublicImg);
		testMap.put("Report_public", Report_public);
		testMap.put("1", "2");

		// 公用工程
		testMap.put("watersupplymethod", water_supply_method);
		testMap.put("powersupplymethod", power_supply_method);
		testMap.put("sewagewater", sewage_water);
		testMap.put("sewagewaterability", sewage_water_ability);
		testMap.put("sewagepath", sewage_path);
		testMap.put("sewageplant", sewage_plant);
		testMap.put("provideheat", provide_heat);
		testMap.put("fuelsupply", fuel_supply);
		testMap.put("1", "2");

		// 设置文件数量
		testMap.put("b0", b0);
		testMap.put("b1", b1);
		testMap.put("b2", b2);
		testMap.put("b3", b3);
		testMap.put("b4", b4);
		testMap.put("b5", b5);
		testMap.put("b6", b6);
		testMap.put("b7", b7);
		testMap.put("b8", b8);
		testMap.put("b9", b9);
		testMap.put("b10", b10);
		testMap.put("b11", b11);
		testMap.put("b12", b12);
		testMap.put("b13", b13);
		testMap.put("b14", b14);
		testMap.put("b15", b15);
		testMap.put("b16", b16);
		testMap.put("b17", b17);
		testMap.put("b18", b18);
		testMap.put("b19", b19);
		testMap.put("b20", b20);
		// 流程公示
		testMap.put("Publicity_time", Publicity_time);
		testMap.put("Publicity_url_name", Publicity_url_name);
		testMap.put("Publicity_url", Publicity_url);
		return testMap;
	}

	/**
	 * 获取审核表数据
	 * 
	 * @param pid  项目id
	 * @param type 审核类型
	 * @return
	 */
	public Map<String, String> getAudit(String pid, String type) {
		Q q = new Q(
				"select  ea.Id,ea.ProjectId,mr.FullName as audit,ea.Stats,ea.AuditType,mrs.FullName as Modifier from eao_audit as ea LEFT JOIN Mh_Resource as mr on ea.auditor = mr.Member LEFT JOIN Mh_Resource as mrs on ea.Modifier = mrs.Member  where ProjectId = ? and AuditType =? ",
				pid, type);
		DataTable dt = q.fetch();
		DataTable dt3 = new Q("select Id from eao_project_info where Id = ?", pid).fetch();
		String id = null;// dt3.getString(0, "id");
		for (DataRow dr3 : dt3) {
			id = dr3.getString("Id");
		}
		DataTable dt2 = new Q("select ReportOriginal from eao_project_doc where ProjectId =?", id).fetch();
		String report = null;// dt2.getString(0, "Report_original");
		String aid = null; // dt.getString(0, "id");
		String audit = null; // dt.getString(0, "audit");
		String modifier = null; // dt.getString(0, "Modifier");
		String name = null; // dt.getString(0, "audit_type");
		for (DataRow dr : dt) {
			aid = dr.getString("Id");
			audit = dr.getString("audit");
			modifier = dr.getString("Modifier");
			name = dr.getString("AuditType");
		}
		for (DataRow dr2 : dt2) {
			report = dr2.getString("ReportOriginal");
		}

		Map<String, String> testMap = new HashMap<String, String>();
		testMap.put("aid", aid);
		testMap.put("audit", audit);
		testMap.put("modifier", modifier);
		testMap.put("title", name + "修改单");
		testMap.put("name", name);
		testMap.put("report", report);
		return testMap;
	}

	/**
	 * 获取审核回复列表
	 * 
	 * @param aid
	 * @return
	 */
	public List<String[]> getAuditReply(String aid) {
		List<String[]> list = new ArrayList<String[]>();
		DataTable dt2 = new Q(
				"select ear.AuditOpinion,ear.AuditTime,ear.ReviseExplain,ear.ChangeTime from eao_audit_reply as ear where AuditId = ? ORDER BY ear.AuditTime",
				aid).fetch();
		int i = 1;
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//这个是你要转成后的时间的格式
		for (DataRow dr2 : dt2) {
			EaoAuditReply entity = new EaoAuditReply();
			String[] array = new String[5];
			entity.setValue(dr2);
			Long str = Long.valueOf(entity.getAuditTime());
			array[0] = i + "";
			array[1] = entity.getAuditOpinion();
			array[2] = sdf.format(new Date(str));
			array[3] = entity.getReviseExplain();
			array[4] = entity.getChangeTime();
			list.add(array);
			i++;
		}
		return list;
	}

	/**
	 * 获得员工list
	 * 
	 * @param pid
	 */
	public List<String[]> getStaffList(String pid) {
		List<String[]> list = new ArrayList<String[]>();
		DataTable dt = new Q("select StaffName,ReportChapter from eao_project_staff where ProjectId = ?", pid).fetch();
		for (DataRow dr : dt) {
			String name = dr.getString("StaffName");
			String chapter = dr.getString("ReportChapter");
			DataTable dt2 = new Q("select FullName from Mh_Resource where Member = ? ", name).fetch();
			String fullname = null;
			for (DataRow drs : dt2) {
				fullname = drs.getString(0);
			}
			String[] array = new String[2];
			array[0] = fullname;
			array[1] = chapter;
			list.add(array);
		}

		return list;
	}

	/**
	 * 获取周围敏感点list
	 * 
	 * @param pid
	 * @return
	 */
	public List<String[]> getSensitive(String pid) {
		List<String[]> list = new ArrayList<String[]>();
		DataTable dt2 = new Q("select * from eao_sensitive_points where ProjectId =?", pid).fetch();
		for (DataRow dr2 : dt2) {
			EaoSensitivePoints entity = new EaoSensitivePoints();
			String[] array = new String[4];
			entity.setValue(dr2);
			array[0] = entity.getSensitiveName();
			array[1] = entity.getDistance();
			array[2] = entity.getHouseholds();
			array[3] = entity.getEnvFunLevel();
			list.add(array);
		}
		return list;
	}

	/**
	 * 获取周围企业信息list
	 * 
	 * @param pid
	 * @return
	 */
	public List<String[]> getSurroundCompany(String pid) {
		DataTable dt2 = new Q("select * from eao_surround_company where ProjectId =?", pid).fetch();
		List<String[]> list = new ArrayList<String[]>();
		for (DataRow dr2 : dt2) {
			EaoSurroundCompany entity = new EaoSurroundCompany();
			String[] array = new String[4];
			entity.setValue(dr2);
			array[0] = entity.getCompany();
			array[1] = entity.getScDistance();
			array[2] = entity.getEngage();
			array[3] = entity.getDischarge();
			list.add(array);
		}
		return list;
	}

	/**
	 * 获取生产设备list
	 * 
	 * @param pid
	 * @return
	 */
	public List<String[]> getProductionEquipment(String pid) {
		DataTable dt2 = new Q("select * from eao_production_equipment where ProjectId =?", pid).fetch();
		List<String[]> list = new ArrayList<String[]>();
		for (DataRow dr2 : dt2) {
			EaoProductionEquipment entity = new EaoProductionEquipment();
			String[] array = new String[3];
			entity.setValue(dr2);
			array[0] = entity.getEquipment();
			array[1] = entity.getModel();
			array[2] = entity.getQuantity();
			list.add(array);
		}
		return list;
	}

	/**
	 * 获取周围建筑list
	 * 
	 * @param pid
	 * @return
	 */
	public List<String[]> getBuildingContent(String pid) {
		DataTable dt2 = new Q("select * from eao_building_content where ProjectId =?", pid).fetch();
		List<String[]> list = new ArrayList<String[]>();
		for (DataRow dr2 : dt2) {
			EaoBuildingContent entity = new EaoBuildingContent();
			String[] array = new String[2];
			entity.setValue(dr2);
			array[0] = entity.getBuildingName();
			array[1] = entity.getContent();
			list.add(array);
		}
		return list;
	}

	/**
	 * 获取评估意见及修改list
	 * 
	 * @param pid
	 * @return
	 */
	public List<String[]> getAppraise(String pid) {
		DataTable dt2 = new Q("select * from eao_appraise where ProjectId =?", pid).fetch();
		List<String[]> list = new ArrayList<String[]>();
		int i = 1;
		for (DataRow dr2 : dt2) {
			EaoAppraise entity = new EaoAppraise();
			String[] array = new String[3];
			entity.setValue(dr2);
			array[0] = i + "";
			array[1] = entity.getAppraiseOpinion();
			array[2] = entity.getReviseExplain();
			list.add(array);
			i++;
		}
		return list;
	}

	/**
	 * 获取公参意见及修改list
	 * 
	 * @param pid
	 * @return
	 */
	public List<String[]> getPublicQuestions(String pid) {
		DataTable dt2 = new Q("select * from eao_publicity_questions where ProjectId =?", pid).fetch();
		List<String[]> list = new ArrayList<String[]>();
		int i = 1;
		for (DataRow dr2 : dt2) {
			EaoPublicityQuestions entity = new EaoPublicityQuestions();
			String[] array = new String[3];
			entity.setValue(dr2);
			array[0] = i + "";
			array[1] = entity.getPublicityOpinion();
			array[2] = entity.getReviseExplain();
			list.add(array);
			i++;
		}
		return list;
	}

	public List<String[]> findByAuditor(int pageSize, int pageIndex, String startTime, String endTime) {
		if (pageSize == 0) {
			pageSize = 10;
		}
		pageIndex = (pageIndex - 1) * pageSize;
		String auditor = Long.toString(Member.getUID()); // 默认为登录人
		if (StringUtils.isEmpty(auditor)) {
			return null;
		}
		Q q = new Q(
				"select ei.Company,ei.BranchInnerCode,ei.ProjectName,ei.ProjectNumber,ei.ReportType,ei.ApprovalUnit,ei.PerjectType as stats,zb.AuditType,AuditDotime as AuditDate,zb.AuditScore from eao_audit AS zb LEFT JOIN eao_project_info AS ei on zb.projectId = ei.Id where zb.Auditor = ? AND zb.stats = '已审核'",
				auditor);
		if (StringUtil.isNotEmpty(startTime) & StringUtil.isNotEmpty(endTime)) {
			q.append(" and DATE_FORMAT(AuditDotime,'%Y-%m-%d') between ? and ?", startTime, endTime);
		} else if (StringUtil.isNotEmpty(startTime) & StringUtil.isEmpty(endTime)) {
			q.append(" and DATE_FORMAT(AuditDotime,'%Y-%m-%d') > ? ", startTime);
		} else if (StringUtil.isEmpty(startTime) & StringUtil.isNotEmpty(endTime)) {
			q.append(" and DATE_FORMAT(AuditDotime,'%Y-%m-%d') < ? ", endTime);
		}
		q.append(" limit ?,?", pageIndex, pageSize);
		List<String[]> list = new ArrayList<String[]>();
		DataTable dt1 = q.fetch();
		int i = 1;
		for (DataRow dr3 : dt1) {
			DataTable dt2 = new Q("select Name from Mh_Branch where Company=? AND BranchInnerCode =?",
					dr3.getString("Company"), dr3.getString("BranchInnerCode")).fetch();
			String[] array = new String[9];
			for (DataRow dr4 : dt2) {
				array[0] = i + "";
				array[1] = dr3.getString("ProjectNumber");
				array[2] = dr3.getString("ProjectName");
				array[3] = dr4.getString("Name");
				array[4] = dr3.getString("ReportType");
				array[5] = dr3.getString("ApprovalUnit");
				array[6] = dr3.getString("AuditType");
				array[7] = dr3.getString("AuditDate");
				array[8] = dr3.getString("AuditScore");
			}
			list.add(array);
			i++;
		}

		return list;
	}

	public Map<String, String> getAuditorMap(String startTime, String endTime) {
		Map<String, String> testMap = new HashMap<String, String>();
		String auditor = Long.toString(Member.getUID()); // 默认为登录人
		Q q3 = new Q(
				"select SUM(he)as jixiao,GROUP_CONCAT(zongshu ,'个',reportType)as shuju from (select SUM(AuditScore) as he ,AuditDotime,Auditor,COUNT(ProjectId) as zongshu,ReportType from eao_audit INNER JOIN eao_project_info  on eao_audit.ProjectId = eao_project_info.Id  where eao_audit.stats = '已审核' And eao_project_info.ReportType='报告书' ");
		if (StringUtil.isNotEmpty(startTime) & StringUtil.isNotEmpty(endTime)) {
			q3.append(" and DATE_FORMAT(AuditDotime,'%Y-%m-%d') between ? and ?", startTime, endTime);
		} else if (StringUtil.isNotEmpty(startTime) & StringUtil.isEmpty(endTime)) {
			q3.append(" and DATE_FORMAT(AuditDotime,'%Y-%m-%d') > ? ", startTime);
		} else if (StringUtil.isEmpty(startTime) & StringUtil.isNotEmpty(endTime)) {
			q3.append(" and DATE_FORMAT(AuditDotime,'%Y-%m-%d') < ? ", endTime);
		}
		q3.append(
				"and Auditor =? GROUP BY Auditor UNION select SUM(AuditScore)as he ,AuditDotime,Auditor,COUNT(ProjectId) as zongshu,ReportType from eao_audit INNER JOIN eao_project_info  on eao_audit.ProjectId = eao_project_info.Id  where eao_audit.stats = '已审核' And eao_project_info.ReportType='报告表'",
				auditor);
		if (StringUtil.isNotEmpty(startTime) & StringUtil.isNotEmpty(endTime)) {
			q3.append(" and DATE_FORMAT(AuditDotime,'%Y-%m-%d') between ? and ?", startTime, endTime);
		} else if (StringUtil.isNotEmpty(startTime) & StringUtil.isEmpty(endTime)) {
			q3.append(" and DATE_FORMAT(AuditDotime,'%Y-%m-%d') > ? ", startTime);
		} else if (StringUtil.isEmpty(startTime) & StringUtil.isNotEmpty(endTime)) {
			q3.append(" and DATE_FORMAT(AuditDotime,'%Y-%m-%d') < ? ", endTime);
		}
		q3.append("and Auditor = ? GROUP BY Auditor) as sssc  GROUP BY Auditor ", auditor);
		String sum = "";
		Integer score = 0;
		DataTable dt3 = q3.fetch();
		for (DataRow dr3 : dt3) {
			score = dr3.getInt("jixiao");
			sum = dr3.getString("shuju");
		}
		testMap.put("score", score + "");
		testMap.put("sum", sum);
		return testMap;
	}

}